package demo2;

import java.awt.*;

interface IShape {
    void draw();
}

class Rect implements IShape {
    @Override
    public void draw() {
        System.out.println("画矩形");
    }
}
class Cycle implements IShape {
    @Override
    public void draw() {
        System.out.println("画圆圈");
    }
}
class Flower implements IShape {
    @Override
    public void draw() {
        System.out.println("画❀");
    }
}
public class Test {
    public static void main(String[] args) {
        Computer computer = new Computer();
        computer.powerOn();

        computer.useDevice(new Mouse());
        computer.useDevice(new KeyBoard());

        computer.powerOff();
    }














    public static void func(IShape ishape) {
        ishape.draw();
    }
    public static void main1(String[] args) {
        IShape iShape1 = new Flower();
        IShape iShape2 = new Cycle();
        IShape iShape3 = new Rect();

//        func(iShape1);
//        func(iShape2);
//        func(iShape3);

        //func(iShape3);
        IShape[] iShapes = {iShape1,iShape2,iShape3};
        for(IShape s:iShapes) {
            func(s);
        }
    }
}
